#ifndef _WORLD__H
#define _WORLD__H

#include "global.h"
#include <stdint.h>

#define WORLD_BOUNDARY 25
#define BODY_ENERGY_MAX (200 * 1000)

typedef enum BOOL {
    FALSE = 0,
    TRUE = 1
} BOOL;

typedef struct UNIT {
    uint8_t type;   // enum TYPE, 用于识别
    char data;      // character, 用于显示
    BOOL is_reveal; // is reveal for body, show with green color
} UNIT;

extern UNIT g_unit[WORLD_BOUNDARY][WORLD_BOUNDARY];

typedef struct BODY_ITEM {
    int32_t x;
    int32_t y;
    int32_t energy;
    uint8_t direction;  // peek direction, enum DIRECTION
    uint8_t last_direct;// enum DIRECTION
    int8_t data_near;   // enum TYPE
    int8_t data_far;
} BODY_ITEM;

extern void world_init(void);
extern void world_step(void);
extern void world_display(void);
extern void world_exit(void);
extern void world_add_body(BODY_ITEM *body);
extern void world_body_peep(BODY_ITEM *body);

#endif // _WORLD__H
